﻿Public Class Dungeon

    Private _party As PartyObj
    Private _theme As DungeonTheme
    Private _anchor As Point

    Public Sub New(ByVal party As PartyObj)

        InitializeComponent()

        _party = party
        _theme = New DungeonTheme()
        Me.Text = _theme.ThemeName
        MessageBox.Show(_theme.ThemeText, _theme.ThemeName, MessageBoxButtons.OK)

        Dim anchorX As Integer = Me.Width / 2
        Dim anchorY As Integer = Me.Height / 2
        _anchor = New Point(anchorX, anchorY)

        Dim anchorRoom As DungeonPieceObj = _theme.DeckManager.MainDeck.PopTopRoom()

        For Each floor As DungeonFloorObj In anchorRoom.GetFloor(anchorX, anchorY, DungeonPieceObj.eOrientation.Vertical, False, Me)

            Me.Controls.Add(floor)

        Next

        ''debugging
        'For i As Integer = 0 To _theme.DeckManager.MainDeck.Count - 1
        '    AddText(String.Format("Room {0}: {1}", i, _theme.DeckManager.MainDeck.PeekAtRoomAtIndex(i).ToString()) + vbNewLine)
        'Next

        ''end debugging

    End Sub

    '    Public Sub AddText(ByVal sz As String)

    '        While txtOutput.TextLength + sz.Length > txtOutput.MaxLength
    '            txtOutput.Text = txtOutput.Text.Substring(txtOutput.Text.IndexOf(vbNewLine))
    '        End While

    '        txtOutput.Text += sz
    '        Me.Update()

    '    End Sub


    '#Region " Event Handlers "

    '    Public Sub DungeonScreenClosing() Handles Me.FormClosing
    '        Application.Exit()
    '    End Sub

    '#End Region

End Class